<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/commons/pages/taglibs.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>主机信息</title>
<link rel="stylesheet" type="text/css" href="../jquery-easyui/themes/${themes}/easyui.css">
<link rel="stylesheet" type="text/css" href="../jquery-easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="../styles/demo.css">
<script type="text/javascript" src="../jquery-easyui/jquery.min.js"></script>
<script type="text/javascript" src="../jquery-easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../scripts/public.js.jsp"></script>
<script type="text/javascript" src="${ctx}/platform/type-info/format"></script>
</head>
<body>
<!--div class="demo-info">
  <div class="demo-tip icon-tip"></div>
  <div>主机信息</div>
</div-->
<c:if test="${true}">
  <div style="padding:5px; margin-bottom:5px; display:block;" class="combo">
    <form method="post" id="fm_search" novalidate style="display:inline-block">
      DTU ID：
        <select id="modem_id" name="modem_id" style="width:80px;">
      </select>
      <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="doSearch();">搜索</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="$('#fm_search').form('clear');">重置</a>
    </form>
    <c:import url="__refresh.jsp" />
  </div>
</c:if>
<div id="dg"> </div>
<script type="text/javascript">
$(function(){
	//初始化列表
	$('#dg').datagrid({  
	    url:'${ctx}/platform/bmu-master-info/search',
		queryParams:$('#fm_search').serializeObject(),
	    //frozenColumns:[[
	    //	{field:'ck',checkbox:true}
	 	//]],
	    columns:[[
	  			{align: 'left'  ,/*width: 90, */ title: '数据产生时间', field: 'data_create_time',formatter: formatDateTimeNoYear},
		        {align: 'center',/*width: 70, */ title: 'DTU ID', field: 'modem_id'},
		        {align: 'right' ,/*width: 40, */ title: 'SOC', field: 'soc', formatter: function (value) {return value + '%';}},
		        {align: 'left'  ,/*width: 99, */ title: '电池状态<br />充电|通信|过湿|过放|过充SOC过低|SOC过高|均衡|过流|温差', field: 'batterys_status', formatter: function (value) {
		        	value = new Number(value).toString(2).leftPad(24, "0");
		        	var status = [];
		        	status.push(['<span style="color:green;">非充</span>', '<span style="color:red;">充电</span>'][value.charAt(23)]);
		        	//status.push(['<span style="color:green;">绝缘正常</span>', '<span style="color:red;">绝缘过低</span>'][value.charAt(22)]);
		        	status.push(['<span style="color:green;">正常</span>', '<span style="color:red;">中断</span>'][value.charAt(21)]);
		        	status.push(['<span style="color:green;">正常</span>', '<span style="color:red;">过湿</span>'][value.charAt(20)]);
		        	status.push(['<span style="color:green;">正常</span>', '<span style="color:red;">过放</span>'][value.charAt(19)]);
		        	status.push(['<span style="color:green;">正常</span>', '<span style="color:red;">过充</span>'][value.charAt(18)]);
		        	status.push(['<span style="color:green;">SOC正常</span>', '<span style="color:red;">SOC过低</span>'][value.charAt(17)]);
		        	status.push(['<span style="color:green;">SOC正常</span>', '<span style="color:red;">SOC过高</span>'][value.charAt(16)]);
		        	status.push(['<span style="color:green;">关闭</span>', '<span style="color:red;">开启</span>'][value.charAt(15)]);
		        	status.push(['<span style="color:green;">正常</span>', '<span style="color:red;">过流</span>'][value.charAt(14)]);
		        	status.push(['<span style="color:green;">正常</span>', '<span style="color:red;">过大</span>'][value.charAt(13)]);
		        	return status.join("|");
		        }},
		        {align: 'center',/*width: 40, */title: '总<br />容量<br />(AH)', field: 'capacity_total'}, 
		        {align: 'center',/*width: 40, */title: '剩余<br />容量<br />(AH)', field: 'capacity_remain'},
		        {align: 'center',/*width: 50, */title: '电池组<br />总电压<br />(V)', field: 'voltage_total'}, 
		        {align: 'center',/*width: 40, */title: '电池组<br />总电流<br />(A)', field: 'current_total'},
		        {align: 'center',/*width: 40, */title: '电池<br />组<br />充电<br />次数', field: 'recharge_cycles'},
		        {align: 'center',/*width: 50, */title: '绝缘<br />正极<br />电阻<br />(KΩ)', field: 'resistance_positive'},
		        {align: 'center',/*width: 50, */title: '绝缘<br />负极<br />电阻<br />(KΩ)', field: 'resistance_negative'},
		        {align: 'center',/*width: 50, */title: '总绝缘<br />电阻<br />(KΩ)', field: 'resistance_total'},
		        {align: 'center',/*width: 30, */ title: '绝缘<br />模块<br />工作<br />状态', field: 'resistance_status', formatter: function (value) {
		        	switch(parseInt(value)) {
			        	case 0:return '<span style="color:green;">正常</span>'; break;
			        	case 1:return '<span style="color:red;" title="系统漏电">异常</span>'; break;
			        	case 2:return '<span style="color:red;" title="绝缘模块离线">异常</span>'; break;
			        	case 3:return '<span style="color:red;" title="绝缘母线异常">异常</span>'; break;
		        	}
		        }},
		        {align: 'center',/*width: 40, */title: 'SOH', field: 'soh', formatter: function (value) {return value + '%';}},
		        {align: 'center',/*width: 40, */title: '最高<br />单体<br />电压<br />(mV)', field: 'battery_voltage_high'},
		        {align: 'center',/*width: 40, */title: '最低<br />单体<br />电压<br />(mV)', field: 'battery_voltage_low'},
		        {align: 'center',/*width: 30, */title: '最高<br />箱体<br />温度<br />(℃)', field: 'box_temp_high'},
		        {align: 'center',/*width: 30, */title: '最低<br />箱体<br />温度<br />(℃)', field: 'box_temp_low'},
		        {align: 'center',/*width: 30, */title: '最高<br />单体<br />电压<br />箱体<br />号', field: 'box_no_voltage_high'},
		        {align: 'center',/*width: 30, */title: '最高<br />单体<br />电压<br />串号', field: 'searies_no_voltage_high'},
		        {align: 'center',/*width: 30, */title: '最低<br />单体<br />电压<br />箱体<br />号', field: 'box_no_voltage_low'},
		        {align: 'center',/*width: 30, */title: '最低<br />单体<br />电压<br />串号', field: 'searies_no_voltage_low'},
		        {align: 'center',/*width: 30, */title: '最高<br />温度<br />箱体<br />号', field: 'box_no_temp_high'},
		        {align: 'center',/*width: 30, */title: '最高<br />温度<br />串号', field: 'searies_no_temp_high'},
		        {align: 'center',/*width: 30, */title: '最低<br />温度<br />箱体<br />号', field: 'box_no_temp_low'},
		        {align: 'center',/*width: 30, */title: '最低<br />温度<br />串号', field: 'searies_no_temp_low'}
	        ]],
		//fitColumns:true,
		striped:true,
		pagination:true,
		remoteSort:false,
		//rownumbers:true,
		singleSelect:true,
		autoSizeColumn:true 
	}); 
}); 
</script>
</body>
</html>